{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "harmful-diary",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/find-the-duplicate-number\n",
    "\n",
    "Runtime: 20 ms, faster than 29.99% of C++ online submissions for Find the Duplicate Number.\n",
    "Memory Usage: 12.7 MB, less than 19.29% of C++ online submissions for Find the Duplicate Number.\n",
    "\n",
    "```\n",
    "#include <map> \n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    int findDuplicate(vector<int>& nums) {\n",
    "        map<int, int> m;\n",
    "        for (int i=0; i<nums.size(); i++) {\n",
    "            if (m.find(nums[i]) != m.end()) {\n",
    "                m[nums[i]] += 1;\n",
    "                return nums[i];\n",
    "            } else {\n",
    "                m[nums[i]] = 1;\n",
    "            }\n",
    "        }\n",
    "        return 0;\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bound-isaac",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
